package com.zz.yt.test.delegate.pdf;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.whf.android.jar.base.delegate.BaseDelegate;
import com.whf.android.jar.web.WebDelegateImpl;
import com.zz.yt.test.R;

public class PdfDelegate extends BaseDelegate {

    @NonNull
    public static PdfDelegate newInstance() {

        Bundle args = new Bundle();

        PdfDelegate fragment = new PdfDelegate();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected Object setLayout() {
        return R.layout.activity_pdf;
    }

    @Override
    protected void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
        addMarginTopEqualStatusBarHeight(findViewById(R.id.id_layout_frame));
        String pdf = "file:///android_asset/pdf123.pdf";
        WebDelegateImpl delegate = WebDelegateImpl.create("file:///android_asset/pdf/show_pdf.html?" + pdf);
        delegate.setPageLoadListener(this);
        delegate.setTopDelegate(this);
        getSupportDelegate().loadRootFragment(R.id.id_layout_frame, delegate);
    }

}
